package com.gg.common.mapper;

import com.gg.common.pojo.SysUsers;
import com.gg.hj.view.SysRolesView;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface SysUsersMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(SysUsers record);

    int insertSelective(SysUsers record);

    SysUsers selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(SysUsers record);

    int updateByPrimaryKey(SysUsers record);

    SysUsers selectByLoginId(String loginId);

    /**
     * TODO 用户信息查询
     * @return SysUsers
     * @throws Exception
     */
    List<SysUsers> queryUserAll() throws Exception;

    /**
     * TODO 根据登入人主键查询具有的角色
     * @param userId
     * @return SysRoles
     * @throws Exception
     */
    List<SysRolesView> searchQueryByIdRole(int userId) throws Exception;


    /**
     * TODO 删除授权目标角色
     * @param authorizeId
     * @param roleIds
     */
    void removeRoleId(@Param("authorizeId") int authorizeId, @Param("roleIds")int[] roleIds) throws Exception;

    /**
     * TODO 添加授权目标角色
     * @param authorizeId
     * @param roleIds
     */
    void saveRoleId(@Param("authorizeId") int authorizeId,@Param("roleIds")int[] roleIds) throws Exception;

    /**
     * TODO 查询账号是否存在
     * @param account
     * @return SysUsers
     * @throws Exception
     */
    SysUsers searchQueryUsersAccount(String account) throws Exception;
}